#pragma once
#include "afxstd.h"

#include <osg/Geode>
#include <osg/Node>
#include <osg/Geometry>
#include <osgDB/Registry>
#include <osgDB/WriteFile>
#include <osg/Notify>
#include <osg/ref_ptr>
#include <osgViewer/Viewer>
#include <osgUtil/SceneView>
#include "wx/defs.h"
#include "wx/app.h"
#include "wx/cursor.h"
#include "wx/glcanvas.h"
class wxSceneCanvas;
class wxSceneGraphicsContext : public osgViewer::GraphicsWindow
{
protected:
	virtual ~wxSceneGraphicsContext();
public:
	wxSceneGraphicsContext(wxSceneCanvas* canvas);

	void detachFromCanvas();

	bool valid() const;
	bool realizeImplementation();
	bool isRealizedImplementation() const;
	void closeImplementation();
	bool makeCurrentImplementation();
	bool makeContextCurrentImplementation(osg::GraphicsContext *context);
	bool releaseContextImplementation();
	void bindPBufferToTextureImplementation(GLenum buffer);
	void swapBuffersImplementation();

	wxGLContext* getWxContext();
	unsigned int getGlContext();
private:
	wxGLContext* pGLContext;
	wxSceneCanvas* pSceneCanvas;
	static unsigned int sGLContextRefs;
	unsigned int mGLContextID;
};

